#pragma once
#include "EventLoop.h"
#include "ThreadPool.h"
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include "Channel.h"
#include "TcpConnection.h"
#include "Log.h"
#include<signal.h>
#define BACKLOG 128
struct Listener
{
    int lfd;
    unsigned short port;
};

struct TcpServer
{
    /* data */

    struct EventLoop *mainLoop;
    struct ThreadPool *threadPool;
    int threadNum;
    struct Listener *listener;
};

void ignore_sigpipe();
// 初始化
struct TcpServer *tcpServerInit(unsigned short port, int threadnum);
// 初始化用于监听的文件描述符
struct Listener *listenserInit(unsigned short port);
// 启动服务器
void tcpserverRun(struct TcpServer* tcpserver);
